package array.nowcoder.easy;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author bruin_du
 * @description 合唱团
 * @date 2022/7/8 23:25
 **/
public class Chorus {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        int k = in.nextInt(),d = in.nextInt();
        Arrays.sort(arr);
        int[] diff = new int[n - 1];
        for (int i = 0; i < diff.length; i++) {
            diff[i] = arr[i + 1] - arr[i];
        }
        long ret = 0;
        for (int i = 0; i < n - k + 1; i++) {
            ret = Math.max(ret,max(arr,diff,d,i,i + k - 1));
        }
        if (k != 1) {
            ret = Math.max(ret, max(arr, diff, d, 0, k - 2) * arr[n - 1]);
        }
        System.out.println(ret);
    }

    private static long max(int[] arr, int[] diff, int d, int left, int right) {
        for (int i = left; i < right - left; i++) {
            if (diff[i] > d) {
               return 0;
            }
        }
        long ret = 1;
        for (int i = left; i <= right; i++) {
            ret *= arr[i];
        }
        return ret;
    }
}
